import { axios as request  } from '@/utils/request'
import cloneDeep from 'lodash.clonedeep'
export function saveOrder(data) {
  return request({
    url: 'api/v2/order/vin',
    method: 'put',
    data
  })
}

export function saveFee(data) {
  const copyData = cloneDeep(data)
  copyData.paymentType = `[${copyData.paymentType.join(',')}]`
  return request({
    url: 'api/v2/order/finance',
    method: 'put',
    data: copyData
  })
}

export function savePick(data) {
  return request({
    url: 'api/pick',
    method: 'put',
    data
  })
}

export function saveTake(data) {
  return request({
    url: 'api/take',
    method: 'put',
    data
  })
}

export function saveTransport(data) {
  return request({
    url: 'api/v2/order/transport-cost',
    method: 'put',
    data
  })
}

export function saveSign(data) {
  return request({
    url: 'api/order/sign',
    method: 'put',
    data
  })
}

export function saveOtherFee(data) {
  return request({
    url: 'api/extra-fee',
    method: 'put',
    data
  })
}

export function addOtherFee(data) {
  return request({
    url: 'api/extra-fee',
    method: 'post',
    data
  })
}

export function delOtherFee(id) {
  return request({
    url: `api/extra-fee/${id}`,
    method: 'delete'
  })
}

export function getOtherFeeSettlementSuggest() {
  return request({
    url: 'api/finance/extra-settlement-user',
    method: 'get'
  })
}
